﻿using System.Web.Mvc;
using FikriKibar.Business.Abstract;
using FikriKibar.Business.Concrete;
using FikriKibar.Common.Helpers;
using FikriKibar.UI.WebCommon.Helpers;
using FikriKibar.UI.WebCommon.Infrastructure;


namespace FikriKibar.UI.WebManagement.Controllers
{
    public class CaptchaController : FikriKibarController
    {
        #region Global Declarations
        private readonly ISettingService _settingService = new SettingManager();
        #endregion
        #region Methods
        public FileResult Get()
        {
            var imgPath = Server.MapPath(_settingService.GetValueByKey("CaptchaBackgroundImagePath"));
            var captchaLenght = _settingService.GetValueByKey("CaptchaLenght").ConvertToInt();
            return File(CaptchaHelper.GetCaptchaBytes(imgPath, captchaLenght), "image/jpeg");
        }
        #endregion
    }
}